<?php
include_once 'avatar.php';
//horn, tracks, ....

class Elementbox {
	
	private $code = '';
	
	public function __construct($element, $layout, $position){
		$this->code.='<frame posn="'.$position.'">';
		switch ($layout){
			default :
			case 0:
				$k = 0;
				for ($i = 40; $i >= -40; $i -= 40){ //y
					for ($j = -120; $j <= 120; $j += 40){ //x
						if (@$element[$k]) $this->code.=$element[$k]->showSquare($j.' '.$i.' 0');
						else break;
						$k++;
					}
					if (@!$element[$k]) break;
				}
				break;
			
			case 1:
				$k = 0;
				for ($i = 40; $i>= -40; $i -= 40){
					for ($j = -140; $j <= 100; $j += 80){
						if (@$element[$k]) $this->code.=$element[$k]->showRectangle($j.' '.$i.' 0');
						else break;
						$k++;
					}
					if (@!$element[$k]) break;
				}
				break;
				
			case 2:
				$this->code.='<frame posn="20 0 0">
					<quad posn="-140 55 -1" sizen="20 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="-139 55 0" sizen="20 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fID" />
					<quad posn="-120 55 -1" sizen="70 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="-119 55 0" sizen="70 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fName" />
					<quad posn="-50 55 -1" sizen="40 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="-49 55 0" sizen="40 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fAutor" />
					<quad posn="-10 55 -1" sizen="40 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="-9 55 0" sizen="40 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fLogin" />
					<quad posn="30 55 -1" sizen="30 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="31 55 0" sizen="30 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fDownloads" />
					<quad posn="60 55 -1" sizen="40 5" halign="left" valign="bottom" style="Bgs1" substyle="BgCard3" />
					<label posn="61 55 0" sizen="40 5" halign="left" valign="bottom" style="TextButtonBig" text="$09fDate" />
					</frame>
				';
				$k = 0;
				for ($i = 50; $i >= -60; $i -= 5){
					if (@$element[$k]) $this->code.=$element[$k]->showLine('-130 '.$i.' 0');
					else break;
					$k++;
				}
				break;
				
		}
		$this->code.='</frame>';
	}
	
	public function __toString(){
		return $this->code;
	}
}

?>